<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../../../common/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<sfa:mainTitle></sfa:mainTitle>
		<%@ include file="../../../common/meta.jsp"%>
<script type="text/javascript">
function changeStatistics(){
		var val = $("#statistics").val();
		if(val=="A"){
			  $("#agents").css("background-color","").removeAttr("disabled");
		}else{ 
			  $("#agents").css("background-color","#F2F2F2").val("").attr("disabled","disabled");
		}
}

$(function(){
	
	changeStatistics();
});

</script>
</head>
	<body id="master">

		<sfa:mainHeader></sfa:mainHeader>
		<div class="webpart3 contentarea">
			<div class="webpart-head">
				<div class="webpart-head-item">
					考勤查询
				</div>
			</div>
			<div class="webpart-main">
			<div class="webpart-main-item" style="padding-top: 5px;">
			<div class="search">
				<form method="get">
					<table cellspacing="0" cellpadding="0" style="width: 100%;"
						class="serch_table">
						<tbody>
							<tr>
								<th>
									起始日期 :
								</th>
								<td>
									<input id="createdatebegin" name="createdatebegin" type="text"
										onClick="WdatePicker()" class="Wdate inputbox" readOnly="true"
										value="${begindate}" />
								</td>
								<th>
									结束日期 :
								</th>
								<td>
									<input id="createdateend" name="createdateend" type="text"
										onClick="WdatePicker()" class="Wdate inputbox" readOnly="true"
										value="${enddate}" />
								</td>
								
							</tr>
							<tr>
								<th>
									考勤类型 :
								</th>
								<td>	
									<sfa:dic showType="select" kindNo="CHECKITEM"
										code="${checkitem}" def="ALL:全部;" attr="class='input-txt' style='width: 123px;'"
										name="attendanceType" id="attendancetype"></sfa:dic>
								</td>
								<th>
									考勤级别:
								</th>
								<td>
								<sfa:dic showType="select" kindNo="AGENTLEVELCODE" code="${agentlevel}" def="ALL:全部"
									attr="class='input-txt' style='width: 123px;'" name="agentLevelCode" id="agentLevelCode">
								</sfa:dic>
							</td>
							
							</tr>	
							<tr>
								<th>
									考勤统计 :
								</th>
								<td>	
								 <select name="statistics" id="statistics" class="input-txt" style="width: 123px;" onchange="changeStatistics()">
								 	<option value="A" ${statistics=='A'?'selected':''}>个人</option>
								 	<option value="B" ${statistics=='B'?'selected':''}>职级</option>
								 </select>
								</td>
								<th>
									营 销 员:
								</th>
								<td>
									<input name="agents" id="agents" type="text" class="inputbox" disabled="disabled" value="${agents}">
								</td>
							
							</tr>	
							<tr>
								<td colspan="4" align="center">
									<input type="submit" class="linkbtn2" value="查询" />
									&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									<input type="button" class="linkbtn2" value="清空"
										onclick="location.href='${path}/team/attendance/index/attendancesta';" />
								</td>
							</tr>
						</tbody>
					</table>
				</form> 
				<c:if test='${statistics=="A"}'>
				<table cellspacing="0" cellpadding="0"
					class="sortable trStyleTable dg_borderstyle" style="margin-top: 5px; width: 100%;text-align: center;">
					<thead>					
						<tr>							
							<th>
								考勤编号
							</th>
							<th>
								姓名
							</th>
							<th>
								层级
							</th>
							<th>
								迟到(次)
							</th>
							<th>
								请假(次)
							</th>
							<th>
								准时(次)
							</th>
							<th width="90px">
								出勤率(%)
							</th>
							<th width="130px">
								未考勤/总考勤(次)
							</th>
						</tr>
						</thead>
						<tbody>
						<c:forEach items="${list.resultList}" var="temp">
							<tr>
								<td>
									<div title="${temp.agentCode}"
										style="width: 80px; overflow: hidden; text-overflow: ellipsis">
										${temp.agentCode}
									</div>
								</td>
								<td>
									<span>
										<div title="${temp.agentName}"
											style="width: 80px; overflow: hidden; text-overflow: ellipsis">
											${temp.agentName}
										</div>
									</span>									
								</td>
								<td>
									<span>
										<sfa:dic showType="value" code="AGENTLEVELCODE_${temp.agentLevel}" def="null:空"></sfa:dic>
									</span>
								</td>
								<td>
									<div title="${temp.beLate}"
										style="width: 30px; overflow: hidden; text-overflow: ellipsis">
										<a href="${path}/team/attendance/index/personal?
										agentcode=${temp.agentCode}&agentname=${temp.agentName}
										&agentlevel=${temp.agentLevel}&checkitem=${checkitem}&checkstatus=CHECKSTATUS_2">
										${temp.beLate}
										</a>
									</div>		
								</td>
								<td>
									<div title="${temp.leave}"
										style="width: 30px; overflow: hidden; text-overflow: ellipsis">
										<a href="${path}/team/attendance/index/personal?
										agentcode=${temp.agentCode}&agentname=${temp.agentName}
										&agentlevel=${temp.agentLevel}&checkitem=${checkitem}&checkstatus=CHECKSTATUS_3">
										${temp.leave}
										</a>
									</div>
								</td>
								<td>
									<div title="${temp.onTime}"
										style="width: 30px; overflow: hidden; text-overflow: ellipsis">
										${temp.onTime}
									</div>
								</td>
								<td>
									<div title="${temp.attendance}"
										style="width: 50px; overflow: hidden; text-overflow: ellipsis">
										${temp.attendance}%
									</div>
								</td>
								<td>
									<div 
										style=" overflow: hidden; text-overflow: ellipsis">
										<c:if test="${(temp.beLate+temp.leave+temp.onTime+temp.nowork)==0}">
										0
										</c:if>
										<c:if test="${(temp.beLate+temp.leave+temp.onTime+temp.nowork)!=0}">
										${temp.nowork}/${(temp.beLate+temp.leave+temp.onTime+temp.nowork)}
										</c:if>
									</div>
								</td>
							</tr>
						</c:forEach>					
						</tbody>	
				</table>
				</c:if>
				<c:if test='${statistics=="B"}'>
				<table cellspacing="0" cellpadding="0"
					class="sortable trStyleTable dg_borderstyle" style="margin-top: 5px; width: 100%;text-align: center;">
					<thead>
						<tr id="dhtr">
							<th>
								<span>考勤类型</span>
							</th>
							<th width="230px">
								<span>考勤时间段</span>
							</th>
							<th>
								<span>层级</span>
							</th>
							<th>
								<span>迟到</span>
							</th>
							<th>
								<span>请假</span>
							</th>
							<th>
								<span>准时</span>
							</th>
							<%--<td>
								<span>未考勤</span>
							</td>
							--%>
							<th>
								<span>出勤率</span>
							</th>
						</tr>
						</thead>
						<tbody>
						<c:forEach items="${list.resultList}" var="temp">
							<tr>
								<td>
									<div>
										<sfa:dic showType="value" code="${temp.checkitem}"></sfa:dic>
									</div>
								</td>
								<td>
									<fmt:formatDate value="${temp.checkStartTime}" pattern="yyyy-MM-dd HH:mm"/>
									~
									<fmt:formatDate value="${temp.checkEndTime}" pattern="yyyy-MM-dd HH:mm"/>
								</td>
								<td>
									<div>
										<sfa:dic showType="value" code="AGENTLEVELCODE_${temp.agentLevel}"></sfa:dic>
									</div>
								</td>
								<td>
									<div>
										<a href="${path}/team/attendance/index/detail?
										checksta=CHECKSTATUS_2&checkitem=${temp.checkItem}&level=${temp.agentLevel}
										&starttime=${temp.checkStartTime}&endtime=${temp.checkEndTime}">
											${temp.beLate}
										</a>
									</div>
								</td>
								<td>
									<span>
									<a href="${path}/team/attendance/index/detail?
										checksta=CHECKSTATUS_3&checkitem=${temp.checkItem}&level=${temp.agentLevel}
										&starttime=${temp.checkStartTime}&endtime=${temp.checkEndTime}">
											${temp.leave}
									</a>	
									</span>
								</td>
								<td>
									<span>
										${temp.onTime}
									</span>
								</td>
								<%--<td>
									<span><a href="${path}/team/attendance/index/detail?
										checksta=CHECKSTATUS_4&checkitem=${temp.checkItem}&level=${temp.agentLevel}
										&starttime=${temp.checkStartTime}&endtime=${temp.checkEndTime}">
											${temp.nowork}
									</a></span>
								</td>--%>
								<td>
									<span>
										${temp.attendance}%
									</span>
								</td>
							</tr>
						</c:forEach>
						</tbody>
				</table>
				</c:if>
				<!----------- 翻页导航 ------------------>
					<div class="dg_pagerstyle">
						<div class="pageinfo">
						</div>
						<div class="pagebtn">
						<c:if test="${not empty list.multiPage}">
							${list.multiPage}
						</c:if>
						</div>
					</div>	
					</div>
				</div>											
			</div>			
				<div class="webpart-foot">
					<div class="webpart-foot-item">
					</div>
				</div>		
		</div>
		<sfa:mainFooter></sfa:mainFooter>
	</body>
</html>


